package com.hx.vending.service;

import com.hx.vending.annotation.CurrentUserId;
import com.hx.vending.util.Msg;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by Administrator on 2018/12/3.
 * 微信支付
 */
public interface IWXPayService {


    /**
     * 预支付订单返回二维码地址(扫码支付)
     * @param totalFee        标价金额：元
     * @param outTradeNoStr   商户订单号
     * @param onlineOrderId   线上订单id
     * @param equipmentId     设备id
     * @param goodsStr        购买的商品出货记录(货道,数量,货道,数量...)
     * @return
     * @throws Exception
     */
    String wxNativePay(Double totalFee, String outTradeNoStr, Integer onlineOrderId, String equipmentId, String goodsStr) throws Exception;


    /**
     * 预支付订单返回预支付标识(公众号支付)
     * @return
     * @throws Exception
     */
    Msg wxJSAPIPay(Integer customerId, Integer onlineOrderId) throws Exception;


    /**
     * 支付后的返回方法
     * @param request
     * @return
     * @throws Exception
     */
    String WXNativeCallBack(HttpServletRequest request) throws Exception;


    /**
     * 授权登陆重定向(客户购买商品Android)
     * @param code
     * @param state
     * @return
     */
    String wxChatRedirect(String code,String state);

    /**
     * 授权登陆重定向(客户购买商品web)
     * @param code
     * @param state
     * @return
     */
    String wxChatRedirectWeb(String code,String state);

    /**
     * 授权登陆重定向(商户提现)
     * @param code
     * @param state
     * @return
     */
    String wxChatCashRedirect(String code,String state);


    /**
     * 微信提现到微信零钱
     * @return
     */
    Msg wxCashWithdrawal(Integer userId, Double money, Integer withDrawalId);

    /**
     * 关闭订单
     * @param outTradeNo 商户订单号
     * @return
     */
    String closeOrder(String outTradeNo);

    /**
     * 判断跳转微信支付还是支付宝支付
     * @param request
     * @return
     */
    String paymentJump(HttpServletRequest request, String onlineOrderId);

    /**
     * 订单退款
     * @param onlineOrderId      订单id
     * @param refundMoney        退款金额
     * @return
     */
    Msg wxRefund(Integer onlineOrderId, Double refundMoney, Integer orderBuyId);

    /**
     * 判断是微信提现还是支付宝提现
     * @param userId      商户id
     * @param money       提现金额
     * @param type        提现类型 0.微信提现到零钱 1.支付宝提现到零钱 2.微信提现到银行卡 3.支付宝提现到银行卡
     * @return
     */
    Msg cashWithDrawalJump(Integer userId, Double money, Integer type, Integer withDrawalId);

    /**
     * 查询用户是否授权登陆
     * @param userId
     * @return
     */
    Msg selectUserOpenId(Integer userId);

    /**
     * 查询商户提现信息
     * @param userId
     * @return
     */
    Msg selectUserWechatMessage(Integer userId, Integer type);

    /**
     * 线下订单支付回调
     * @param underlineOrderId
     * @return
     */
    Msg UnderlinePayCallBack(Integer underlineOrderId);

}
